﻿package com.sxhalo.manage.service.impl;

import java.util.List;

import com.sxhalo.manage.dao.SysUserinfoDAO;
import com.sxhalo.manage.map.SysUserinfo;
import com.sxhalo.manage.service.IBaseService;
import com.sxhalo.manage.utils.Pager;

public class SysUserinfoServiceImpl implements IBaseService<SysUserinfo> {

	private SysUserinfoDAO myDao;

	public SysUserinfoDAO getMyDao() {
		return myDao;
	}

	public void setMyDao(SysUserinfoDAO myDao) {
		this.myDao = myDao;
	}

	@Override
	public void save(SysUserinfo entity) {
		myDao.save(entity);
	}

	@Override
	public void update(SysUserinfo entity) {
		myDao.merge(entity);
	}

	@Override
	public Boolean delete(SysUserinfo entity) {
		try {
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public Boolean delete(Integer id) {
		try {
			SysUserinfo entity = new SysUserinfo();
			entity.setUserinfoId(id);
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public void service() {

	}

	@Override
	public SysUserinfo findById(Object id) {
		return myDao.findById(Integer.parseInt(id.toString()));
	}

	@Override
	public SysUserinfo find(String fieldName, Object fieldValue) {
		List<SysUserinfo> list = findList(fieldName, fieldValue);
		return list.size() > 0 ? list.get(0) : null;
	}

	@Override
	public List<SysUserinfo> findList(String fieldName, Object fieldValue) {
		return myDao.findByProperty(fieldName, fieldValue);
	}

	@Override
	public List<SysUserinfo> findAll() {
		return myDao.findAll();
	}

	@Override
	public List<SysUserinfo> findListByIds(List<String> idList) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Pager<SysUserinfo> findPagerList(int pageNumber, int pageSize,
			String whereStr, String orderStr) {
		return myDao.findPagerList(pageNumber, pageSize, whereStr);
	}

	@Override
	public List<SysUserinfo> findByExample(Object instance) {
		// TODO Auto-generated method stub
		return null;
	}
}
